<template>
  <div>
    <h1>14-wacth与watchEffect的区别</h1>
    <h2>数值:{{ num }}</h2>
  </div>
</template>

<script setup lang="ts">
import { ref, watch, watchEffect } from 'vue'
const num = ref(0)
watch(num, (newVal, oldVal) => {
  console.log('ref watch', newVal, oldVal)
},{
    immediate:true
})
watchEffect(() => {
  console.log('hollw')
})
// setTimeout(() => {
//   num.value = 15
// }, 1500)
</script>

<style scoped></style>
